
package de.stoneageracer.vehicles;

import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Spatial;

/**
 *
 * @author Basti
 */


public class VehiclePart {
    
    /**
     * the Spatial containing the Model of the VehiclePart
     */
    private Spatial mySpatial = null;
    
    /**
     * the weight of the VehiclePart
     */
    private float weight = 0;
    
    public String name;
    
    /**
     * Creates a new VehiclePart to be added to a Car
     * @param spatial the Spatial containing the Model of the VehiclePart
     * @param weight the weight of the single part
     */
    public VehiclePart(String name, Spatial spatial, float weight){
        this.name = name;
        mySpatial = spatial.deepClone();
        this.weight = weight;
    }
    
    /**
     * returns the Model
     * @return a Spatial containing the Model of the VehiclePart
     */
    public Spatial getSpatial(){
        return mySpatial;
    }
    
    /**
     * returns the weight
     * @return the Weight of the single VehiclePart
     */
    public float getWeight(){
        return weight;
    }
    
    /**
     * returns the Rotation of the VehicleParts Spatial (to mainly use in Car-Compositing Editor)
     * @return a Quaternion describing the rotation
     */
    public Quaternion getRotation(){
        return mySpatial.getLocalRotation();
    }
    
    /**
     * returns the Position of the VehicleParts Spatial (to mainly use in Car-Compositing Editor)
     * @return a Vector3f to describe the LocalTranslation
     */
    public Vector3f getLocation(){
        return mySpatial.getLocalTranslation();
    }
    
    /**
     * returns the Size of the VehicleParts Spatial (to mainly use in Car-Compositing Editor)
     * @return a Vector3f to describe the Size in all directions
     */
    public Vector3f getSize(){
        return mySpatial.getLocalScale();
    }
}
